import random


def use_if():
    age = int(input('请输入年龄:'))
    if age >= 18:
        print('可以进入网吧')

    elif age < 18:
        print('不可以进入网吧')

    else:
        print('出现错误')

def use_if_if():
    has_tickets = 1
    knife_length = 15
    if has_tickets:
        if knife_length <=20:
            print('可以上车')
        else:
            print('刀太长不可以上车')
    else:
        print('先买票')

def use_random():
    a = int(input('1是剪刀，2是石头，3是布，您选择:'))
    b = random.randint(1 ,3)
    if b == 1:
        print('电脑出了剪刀')
    if b == 2:
        print('电脑出了石头')
    if b == 3:
        print('电脑出了布')

    if a == 1 or a == 2 or a == 3:
        if (a==1 and b==1)or (a==2 and b==2)or (a==3 and b==3):
            print('平局')
        elif (a==1 and b==2)or(a==2 and b==3)or(a==3 and b==1):
            print('很遗憾，电脑胜利')
        elif (a==2 and b==1)or(a==3 and b==2)or(a==1 and b==3):
            print('恭喜您，您胜利')
    else:
        print('输入非法')


while True:
    use_random()
    # use_if
    # use_if_if()

